import InnovationStudioController from '@/services/InnovationStudio/InnovationStudioController';
import { Collapse, Descriptions, message, Table } from 'antd';
import React,{useState,useEffect} from 'react';
const StudioDetail=(props)=>{
 const {childData} = props
 const [data,setData] = useState({})
 const [dataSource,setDataSource] = useState([])
 const columns=[
    {title:'工号',dataIndex:'userName',align:'center'},
    {title:'姓名',dataIndex:'name',align:'center'},
    {title:'省级部门',dataIndex:'provinceDepartmentName',align:'center'},
    {title:'市级部门',dataIndex:'cityDepartmentName',align:'center'},
    {title:'申请时间',dataIndex:'createdAt',align:'center'},
    {title:'是否工作室负责人',dataIndex:'isLeader',align:'center',render:text=>text==='是'?'是':'否'},
    {title:'状态',dataIndex:'reviewStatus',align:'center'}]
 useEffect(()=>{
    InnovationStudioController.getList({studioCode:childData.studioCode}).then(r=>{
        console.log(r)
        if(r&&r.data.rows.length>0){
            setData(r.data.rows[0])
        }else{
            message.error('未查询到工作是信息')
        }
    })
    InnovationStudioController.getMembersPage({studioCode:childData.studioCode}).then(r=>{
        if(r&&r.data.rows.length>0){
            setDataSource(r.data.rows)
        }
    })
 },[])

 return(
     <div>
                <Descriptions title={'工作室详情'} column={2}>
                    <Descriptions.Item label={'工作室名称'}>{data.studioName}</Descriptions.Item>
                    <Descriptions.Item label={'级别'}>{data.level}</Descriptions.Item>
                    <Descriptions.Item label={'创建时间'}>{data.createdAt}</Descriptions.Item>
                    <Descriptions.Item label={'状态'}>{data.studioStatus}</Descriptions.Item>
                    <Descriptions.Item label={'工作室负责人'} span={2}>{data.studioLeaderName}</Descriptions.Item>
                    <Descriptions.Item label={'工作室简介'}>{data.description}</Descriptions.Item>
                </Descriptions>         
                <Descriptions title={'创新办公室审批'} column={2}>
                    <Descriptions.Item label={'审批人'}>{data.officeAgreementName}</Descriptions.Item>
                    <Descriptions.Item label={'审批时间'}>{data.officeAgreementTime}</Descriptions.Item>
                    <Descriptions.Item label={'审批结果'} span={2}>{data.officeAgreementResult}</Descriptions.Item>
                    <Descriptions.Item label={'审批意见'}>{data.officeAgreementRemark}</Descriptions.Item>
                </Descriptions>
                <Descriptions title={'创新领导小组审批'} column={2}>
                    <Descriptions.Item label={'审批人'}>{data.groupAgreementName}</Descriptions.Item>
                    <Descriptions.Item label={'审批时间'}>{data.groupAgreementTime}</Descriptions.Item>
                    <Descriptions.Item label={'审批结果'} span={2}>{data.groupAgreementResult}</Descriptions.Item>
                    <Descriptions.Item label={'审批意见'}>{data.groupAgreementRemark}</Descriptions.Item>
                </Descriptions>
                <Descriptions title={'工作室成员'} ></Descriptions>
                <Table columns={columns} dataSource={dataSource}/>
     </div>
 )
}
export default StudioDetail;